import requests
# # 1. 简单编码加密
# import base64
#
# info = input("请输入信息:")
# info_base64 = base64.b64encode(info.encode())
# response = requests.get(f"https://httpbin.org/get?info={info_base64}")
# print(response.json())

# # 2. 自定义函数加密 需要使用pyexecjs库,执行js代码块 本质还是node执行的, js代码不能有bom(html标签操作)和dom(windows操作)操作
# import execjs
#
# js = """
# // 简单洗牌加密
# function simpleShuffleEncrypt(str, key) {
#     // 将字符串转换为数组
#     const arr = str.split('');
#     const len = arr.length;
#
#     // 使用密钥作为随机种子
#     let seed = 0;
#     for (let i = 0; i < key.length; i++) {
#         seed += key.charCodeAt(i);
#     }
#
#     // 简单洗牌算法
#     for (let i = len - 1; i > 0; i--) {
#         // 生成伪随机位置
#         seed = (seed * 9301 + 49297) % 233280;
#         const j = Math.floor(seed / 233280 * (i + 1));
#
#         // 交换元素
#         [arr[i], arr[j]] = [arr[j], arr[i]];
#     }
#
#     return arr.join('');
# }
# """
# info = input("请输入信息:")
#
# js_code = execjs.compile(js)
#
# r = js_code.call("simpleShuffleEncrypt", info, 123)
#
# response = requests.get(f"https://httpbin.org/get?info={r}")
# print(response.json())

# 3. 代码混淆

import execjs

js = """
    function _0x17ae(){var _0xf0ff33=['2109891todKYn','22AXffwn','1750TnVxnO','9PoIXPD','4832125cNEnwh','7080108SOcCTM','4yLMcbr','15534040HgbpOf','Hello\x20World!','136RchdWt','24132ZOTGzI','11586btLdoe','12414904EYcszC'];_0x17ae=function(){return _0xf0ff33;};return _0x17ae();}function _0x15e1(_0x44df28,_0x3226c0){var _0x17ae46=_0x17ae();return _0x15e1=function(_0x15e194,_0x33ef6f){_0x15e194=_0x15e194-0x120;var _0x3dc469=_0x17ae46[_0x15e194];return _0x3dc469;},_0x15e1(_0x44df28,_0x3226c0);}(function(_0x5b1931,_0x535113){var _0x2928c3=_0x15e1,_0x36d9c8=_0x5b1931();while(!![]){try{var _0x16a225=parseInt(_0x2928c3(0x129))/0x1*(-parseInt(_0x2928c3(0x127))/0x2)+-parseInt(_0x2928c3(0x12b))/0x3+-parseInt(_0x2928c3(0x124))/0x4*(parseInt(_0x2928c3(0x122))/0x5)+-parseInt(_0x2928c3(0x128))/0x6*(parseInt(_0x2928c3(0x120))/0x7)+-parseInt(_0x2928c3(0x12a))/0x8*(-parseInt(_0x2928c3(0x121))/0x9)+parseInt(_0x2928c3(0x125))/0xa+parseInt(_0x2928c3(0x12c))/0xb*(parseInt(_0x2928c3(0x123))/0xc);if(_0x16a225===_0x535113)break;else _0x36d9c8['push'](_0x36d9c8['shift']());}catch(_0x54ae1f){_0x36d9c8['push'](_0x36d9c8['shift']());}}}(_0x17ae,0xc8bc7));function hi(_0x334de9){var _0x430897=_0x15e1;return _0x430897(0x126)+_0x334de9;}
"""

info = input("请输入信息:")

js_code = execjs.compile(js)

r = js_code.call("hi", info)

response = requests.get(f"https://httpbin.org/get?info={r}")
print(response.json())